package com.dyh.quickdemozwei.pipe0825;

import java.util.ArrayList;
import java.util.List;

public class PipeLineBootStrap {
    private PipeLine pipeLine;
    private List<PipeLineNodeItf> nodes;
    private int index=0;

    PipeLineBootStrap(){
        this.pipeLine = new PipeLine();
        this.nodes  = new ArrayList<>();
    }

    PipeLineBootStrap addLast(PipeLineNodeItf node){
        node.setIndex(index);
        node.setPipeLine(this.pipeLine);
        nodes.add(node);
        index++;
        return this;
    }

    PipeLine build(){
        pipeLine.setNodes(nodes);
        return this.pipeLine;
    }
}
